<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/template.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>StickViewList</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<style type="text/css">
<!--
.STYLE1 {font-weight: bold}
-->
</style>
<!-- InstanceEndEditable -->
<style type="text/css">
<!--
.STYLE1 {font-size: 18px}
-->
</style>
</head>

<body>
<table width="877" height="53" border="0" cellspacing="0" align="center">
  <tr>
    <td width="8">&nbsp;</td>
    <td width="848"><div align="center">
      </p>
      <img src="../../image/logo.jpg" alt="logo" width="929" height="155" /></div></td>
    <td width="15">&nbsp;</td>
  </tr>
</table>
<table width="512" border="0" cellspacing="0" align="center">
  <tr>
    <th width="86" height="29" class="STYLE1" scope="row">about us </th>
    <th width="90" class="STYLE1" scope="row">products show </th>
    <th width="80" class="STYLE1" scope="row">company news </th>
    <td width="104" class="STYLE1"><strong>contact us </strong></td>
    <td width="142"><div align="center" class="STYLE1">
      <p><a href="../../manufacturer/view/ManufacturerViewLogin.php">User Login</a></p>
    </div></td>
  </tr>
</table>

<table width="975" border="0" cellspacing="0">
  <tr>
    <td width="164" rowspan="9"><table border="1"><td height="37" colspan="2" scope="row"><h2>Link List </h2></td>
    </tr>
  <tr>
    <td colspan="2" scope="row"><h3><strong>Stock</strong></h3></td>
    </tr>
  <tr>
    <td colspan="2" scope="row"><a href="StockViewList.php">Stock List</a><br />
            <a href="StockViewAdd.php">Add Stock</a></td>
    </tr>
  <tr>
    <td colspan="2" scope="row"><h3><strong>Raw Material<br />
    </strong></h3></td>
    </tr>
  <tr>
    <td colspan="2" scope="row"><a href="../../rawMaterial/view/rawMaterialViewList.php">Raw Material list</a><a href="../../rawMaterial/view/rawMaterialViewAdd.php"><br />
    Add Raw Material</a> <br /></td>
    </tr>
  <tr>
    <td colspan="2" scope="row"><h3><strong>Sale</strong>-Client</h3></td>
    </tr>
  <tr>
    <td colspan="2" scope="row"><a href="../../sale/client/view/clientViewList.php">Client List</a><br />
            <a href="../../sale/client/view/clientViewAdd.php">Add Client</a></td>
    </tr>
  <tr>
    <td colspan="2" scope="row"><h3>Sale-Merchandise
        </h3></td>
    </tr>
  <tr>
    <td colspan="2" scope="row"><a href="../../sale/merchandise/saleOut/view/merchandiseViewSaleOut.php">Merchandise-Sale out</a><br /><a href="../../sale/merchandise/saleOut/view/merchandiseViewSaleOut.php">Merchandise-Return</a> <br />
      <a href="../../sale/merchandise/saleOut/view/merchandiseViewList.php">Merchandise-List</a></td>
    </tr>
  <tr>
    <td colspan="2" scope="row"><h3>Sale-Order</h3></td>
    </tr>
  <tr>
    <td scope="row"><a href="../../sale/order/view/orderViewList.php">Order-List</a><br />
      <a href="../../sale/order/view/orderViewAdd.php">Order-Add</a>
  </table></td>
    <td width="807" rowspan="8"><!-- InstanceBeginEditable name="EditRegion3" -->
<?php 
    include ("../../Connections/SCMS.php");
	 include ("../../Model/errorReportClass.php");
	 $alret = new errorReportClass();
	 session_start(); 
	$manufacturer = $_SESSION['manufacturer'];
	if($manufacturer == NULL){
	$reportTo ="../../manufacturer/view/ManufacturerViewLogin.php";
       $alret->errorReport(4, $reportTo);
       exit; 
	}
	 
//get information from stock table	 
   $selectedId = $_POST[searchselect];
	$inputValue = $_POST[search];
	
	$retrievalId = $_POST[retrieval];
	$smallValue = $_POST[smallValue];
	$bigValue = $_POST[bigValue];
	
	if($selectedId != NULL){
   	if($selectedId == 5){
 			$query = "select * from stock;";
		}
		else if($selectedId == 0){
 			$query = "select * from stock where sname ='$inputValue';";
		}
		else if($selectedId == 1){
 			$query = "select * from stock where sid ='$inputValue';";
		}
		else if($selectedId == 2){
 			$query = "select * from stock where scost ='$inputValue';";
		}
		else if($selectedId == 3){
 			$query = "select * from stock where snumber ='$inputValue';";
		}
		else if($selectedId == 4){
 			$query = "select * from stock where stockno ='$inputValue';";
		}	
	}
	else if($retrievalId != NULL){
   	if($retrievalId == 0){
 			$query = "select * from stock;";
		}
		else if($retrievalId == 1){
 			$query = "select * from stock where sid between '$smallValue' and '$bigValue';";
		}
		else if($retrievalId == 2){
 			$query = "select * from stock where scost between '$smallValue' and '$bigValue';";
		}
		else if($retrievalId == 3){
 			$query = "select * from stock where stockno between '$smallValue' and '$bigValue';";
		}
		else if($retrievalId == 4){
 			$query = "select * from stock where snumber between '$smallValue' and '$bigValue';";
		}	
	}
	else{
   	$query = "select * from stock;";		
	}
	$sql = mysql_query($query) or die(mysql_error());
	$array = mysql_fetch_array($sql);
?>

<form id="searchingform" name="searchingform" method="post" action="StockViewList.php" >
  <table width="400" border="0" cellspacing="0" align="center">
    <tr>
      <td><h2><strong>Searching: </strong></h2></td>
      <td><select name="searchselect">
        <option value="0">Stock Name</option>
        <option value="1">Stock ID</option>
        <option value="2" >Unit cost</option>
        <option value="3" >Depot NO</option>
        <option value="4" >Number</option>
		  <option value="5" selected="selected">Please Choose</option>
      </select></td>
      <td><input name="search" type="text" size="40" /></td>
      <td><input type="submit" name="Submit3" value="Searching" /></td>
    </tr>
  </table>
</form>


<form id="form1" name="form1" method="post" action="StockViewList.php">
            <table width="608" height="23" border="0" cellspacing="0" align="center">
              <tr>
                <td width="63" height="21"><h2><strong>Retrieval:</strong></h2></td>
                <td width="63"><select name="retrieval">
                  <option value="0"selected="selected">Please Choose</option>
                  <option value="1">Stock ID</option>
                  <option value="2" >Unit cost</option>
                  <option value="3" >Depot NO</option>
                  <option value="4" >Number</option>
                </select></td>
                <td>From:</td>
      <td><input name="smallValue" type="text"/></td>
      <td>To:</td>
      <td><input name="bigValue" type="text"/></td>
      <td><input type="submit" name="Submitretrieval" value="Searching" /></td>
              </tr>
            </table>
</form>

<table border="0" align="center">
<tr>
    <td width="495"><strong>Show Stock: </strong></td>
    <td width="47">&nbsp;</td>
    <td width="47">&nbsp;</td>
    <td width="47">&nbsp;</td>
    <td width="47">&nbsp;</td>
    <td width="70">&nbsp;</td>
</tr>
  <tr>
    <td colspan="6"><table width="773" height="40" border="1" cellspacing="0">
      <tr>
        <td width="92" height="22" class="STYLE1" >Stock ID </td>
        <td width="101" class="STYLE1" >Stock Name</td>
        <td width="72" class="STYLE1" >Number </td>
        <td width="96" class="STYLE1" >Unit cost</td>
        <td width="158" class="STYLE1" >Stock Property </td>
        <td width="90" class="STYLE1" >Depot NO. </td>
        <td width="62" class="STYLE1" >Delete</td>
        <td width="68" class="STYLE1" >Change</td>
      </tr>
	  <?PHP
	   $deletePath = '../ucm/UCStockDelete.php?id=';
		$changePath = '../ucm/UCStockChangeID.php?id=';

     while($array){
      $sid = $array['sid'];
      $sname = $array['sname'];
      $snumber = $array['snumber'];
      $scost = $array['scost'];
      $sproperty = $array['sproperty'];
	   $stockno = $array['stockno'];
			 
      echo ("<tr><td>" .$sid ."</td><td>" .$sname ."</td><td>" .$snumber ."</td>
		<td>" .$scost ."</td><td>" .$sproperty ."</td><td>" .$stockno ."</td>
		<td><a href=\"javascript:if(confirm('Delete?'))location='".$deletePath .$sid ."'\">Delete</a></td>
		<td><a href='".$changePath .$sid."'\">Change</a></td></tr>");
      $array = mysql_fetch_array($sql);
   }	
?>
    </table></td>-  </tr>
  <tr>
    <td colspan="6"><table border="0" align="right">
      <tr>
        <td height="25">&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td><form id="form4" name="form4" method="post" action="RetrivalUser.php">
            
              <div align="right">
                <input type="submit" name="Submit4" value="Cancel" />
              </div>
        </form></td>
      </tr>
    </table></td>
  </tr>
</table>
<?PHP
    $alertId = $_GET[id];

if ($alertId== 1){
   $alrentvalue = 'Success!';
   $alret->alrent($alrentvalue);
}
else if ($alertId== 2){
   $alrentvalue = 'Please Try again!';
   $alret->alrent($alrentvalue);
}
    ?>
<!-- InstanceEndEditable --></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <th scope="row">&nbsp;</th>
    <td>&nbsp;</td>
  </tr>
</table>
</body>
<!-- InstanceEnd --></html>
